using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace Project
{
    public partial class EventTracker : System.Web.UI.Page
    {
        protected System.Web.UI.WebControls.TextBox txt;
        protected System.Web.UI.WebControls.CheckBox chk;
        protected System.Web.UI.WebControls.RadioButton opt1;
        protected System.Web.UI.WebControls.RadioButton opt2;
        protected System.Web.UI.WebControls.ListBox lstEvents;

        protected void Page_Load(object sender, EventArgs e)
        {
            Log("<< Page_Load >>");
        }
        #region Web Form Designer generated code
        override protected void OnInit(EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);
        }

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.txt.TextChanged += new System.EventHandler(this.CtrlChanged);
            this.chk.CheckedChanged += new System.EventHandler(this.CtrlChanged);
            this.opt1.CheckedChanged += new System.EventHandler(this.CtrlChanged);
            this.opt2.CheckedChanged += new System.EventHandler(this.CtrlChanged);
            this.Load += new System.EventHandler(this.Page_Load);
            this.PreRender += new System.EventHandler(this.EventTracker_PreRender);

        }
        #endregion

        private void Log(string entry)
        {
            lstEvents.Items.Add(entry);

            // Select the last item to scroll the list so the most recent
            // entries are visible.
            lstEvents.SelectedIndex = lstEvents.Items.Count - 1;
        }

        private void EventTracker_PreRender(object sender, System.EventArgs e)
        {
            // When the Page.UnLoad event occurs it is too late
            // to change the list.
            Log("Page_PreRender");

        }

        private void CtrlChanged(Object sender, EventArgs e)
        {
            // Find the control ID of the sender.
            // This requires converting the Object type into a Control class.
            string ctrlName = ((Control)sender).ID;
            Log(ctrlName + " Changed");
        }

    }
}
